package main

import (
	"context"
	"fmt"
	"go_stu/5_grpc_stu/3_grpc_hello_go/protos"

	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
)

func main() {
	conn, err := grpc.Dial("127.0.0.1:8083", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		panic(err.Error())
	}
	defer conn.Close()
	c := protos.NewGreeterClient(conn)
	r, err := c.SayHello(context.Background(), &protos.HelloRequest{Name: "Boby"})
	if err != nil {
		panic(err.Error())
	}
	fmt.Println(r.Message)
}
